﻿<Page x:Class="StickyComponentTestPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ex="clr-namespace:StickyComponentExample"
    Title="StickyComponentTestPage" ex:StickyTestComponent.Component="{StaticResource teststicky}">
    <Page.Resources>
        <ex:StickyTestComponentSet x:Key="test2">
            <ex:StickyTestComponent Name="Page Immediate"/>
            <ex:StickyTestComponent Name="Page OnInitialized" AttachMode="OnInitialized"/>
            <ex:StickyTestComponent Name="Page OnLoaded" AttachMode="OnLoaded"/>
        </ex:StickyTestComponentSet>
        <ex:TestStickyPatterns x:Key="UseEvents" 
            Name="UseEvents" UseCommand="False"/>
    </Page.Resources>
    <StackPanel x:Name="TestPage" ex:StickyTestComponent.Component="{StaticResource test2}">
    <TextBlock Margin="10" TextWrapping="Wrap" TextAlignment="Justify">This page demonstrates the behaviour of Sticky Components. It references
    Sticky components defined both in the page's XAML and in Application.xaml. Follow the Debug output in order to
      track the page's and its components' lifetime events. Use the Garbage Collect Page to verify that the components
    don't cause memory leaks. Everything that is defined on the page and the page itself should be finalized when the
    Collect Garbage button is pressed, while the components defined in Application.xaml should remain in memory until the
      Application shuts down.</TextBlock>
        <Button x:Name="AttachButton" Click="AttachButton_Click">Attach</Button>
        <Button x:Name="DetachButton" Click="DetachButton_Click">Detach</Button>
    <Button x:Name="TestEventPatternsButton"  
            ex:TestStickyPatterns.Component="{StaticResource UseEvents}">
      Test Event Patterns</Button>
        <TextBox x:Name="TestCommandPatternsTextBox">
          Test Command patterns. Press Ctrl+Space here to execute the command.</TextBox>
    <TextBlock><Hyperlink NavigateUri="StickyViewModelPage.xaml">Test the Sticky ViewModel Pattern</Hyperlink></TextBlock>
    <TextBlock><Hyperlink NavigateUri="GarbageCollectPage.xaml">Go to Garbage Collect Page</Hyperlink></TextBlock>
  </StackPanel>
</Page>
